<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    img {
      width: 500px;
      height: 500px;
    }

  </style>
</head>

<body>
  <img src="../../../../images/webapi/第一单元/1.webp" alt="">
  <script>

    function fn(N, M) {
      return Math.floor(Math.random() * (M - N + 1) + N)
    }
    const ran = fn(1, 6)  

    // console.log(ran)

    const img = document.querySelector('img')
    img.src = `../../../../images/webapi/第一单元/${ran}.webp`

  </script>

</body>

</html>